package versionControl.aspectj.library;

public aspect Commit {
	/*
	 * Upon any field change in the versioned object - create and store a new 
	 * version of the object 
	 */
	after(Versioned obj) : set(* *.*) && target(obj) && withincode(* *.*(..)) 
	&& !within(versionControl.aspectj.library.*) {
		if (null != obj && (obj.getVersionID() == obj.getLatestVersionID()))
		{
			// Update the obj with the new versionID, 
			// so obj would be using the most updated version
			obj.setVersionID(obj.newVersion());
		}
	}	
}


